home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / util / arcer / xdm20.lha / xdm / cli / xDM_CLI < prev    next >
AmigaDOS Script File  |  1995-09-29  |  8KB  |  347 lines

  1. .key ACTION/A,DRIVE/A,TRACKS/K,FILE/A,START/K,END/K,MODE/K
  2. .bra {
  3. .ket }
  4. .def TRACKS "dos"
  5.  
  6. ; $VER: xDM CLI v2.0 (29.9.95)
  7.  
  8. Set xdmaction {action}
  9. Set xdmdrive {drive}
  10. Set xdmversion {mode}
  11. SetENV xdmstart {start}
  12. SetENV xdmend {end}
  13.  
  14. If {tracks} EQ "all"
  15.     Set xdmtracks "1"
  16. EndIf
  17.  
  18. If {tracks} EQ "dos"
  19.     Set xdmtracks "2"
  20. EndIf
  21.  
  22. If {tracks} EQ "some"
  23.     Set xdmtracks "3"
  24. EndIf
  25.  
  26. Cd >ENV:xdmorigcd
  27. Set xdmcd "$xdmorigcd"
  28.  
  29. If NOT EXISTS ENV:xdm
  30.     If NOT EXISTS ENVARC:xdm
  31.         Set xdm T:
  32.     Else
  33.         Copy >NIL: ENVARC:xdm TO ENV:
  34.     EndIf
  35. EndIf
  36.  
  37. If NOT EXISTS ENV:xdmlzx
  38.     If NOT EXISTS ENVARC:xdmlzx
  39.         Set xdmlzx T:
  40.     Else
  41.         Copy >NIL: ENVARC:xdm TO ENV:
  42.     EndIf
  43. EndIf
  44.  
  45. If NOT EXISTS C:dd
  46.     Set xdmerror dd
  47.     Skip errorout
  48. EndIf
  49.  
  50. If NOT EXISTS C:PackDev
  51.     Set xdmerror PackDev
  52.     Skip errorout
  53. EndIf
  54.  
  55. If NOT EXISTS C:LZX
  56.     Set xdmerror LZX
  57.     Skip errorout
  58. EndIf
  59.  
  60. If $xdmversion EQ "lowmem"
  61.     If NOT EXISTS ENV:xdm
  62.         Set xdmerror "lowmem"
  63.         Skip errorout
  64.     EndIf
  65.     If NOT EXISTS ENV:xdmlzx
  66.         Set xdmerror "lowmem"
  67.         Skip errorout
  68.     EndIf
  69.     Set xdmmode "lowmem"
  70. EndIf
  71.  
  72. LAB startpack
  73. If $xdmdrive EQ "RAD:"
  74.     Assign >NIL: RAD: EXISTS
  75.     If WARN
  76.         Echo "Mounting RAD:"
  77.         Mount >NIL: RAD:
  78.     EndIf
  79. EndIf
  80.  
  81. If $xdmaction EQ "A"
  82.     Skip compress
  83. EndIf
  84.  
  85. If $xdmaction EQ "X"
  86.     Skip decompress
  87. EndIf
  88.  
  89. LAB compress
  90. Set xdmdest {file}.xdm
  91.  
  92. If EXISTS $xdmdest
  93.     Set xdmerror "fileexists"
  94.     Skip errorout
  95. EndIf
  96.  
  97. If $xdmtracks EQ "3"
  98.     Eval >ENV:xdmskip $xdmstart*22
  99.     Eval >ENV:xdmcount $xdmend-$xdmstart*22+22
  100. EndIf
  101.  
  102. Echo "*n*e[32mxDM v2.0 - © 1995 Adam Chapman*e[0m"
  103. Echo "Reading disk image... Please wait!"
  104. Cd "$xdm"
  105. Date >ENV:xdmdate1
  106. Echo >ENV:xdmtime1 "$xdmdate1" LEN=5
  107. Echo >ENV:xdmmins1 "$xdmtime1" FIRST=1 LEN=2
  108. Echo >ENV:xdmsecs1 "$xdmtime1" LEN=2
  109.  
  110. If $xdmtracks EQ "3"
  111.     ChangeTaskPri 5
  112.     dd -c$xdmcount -s$xdmskip -r$xdmdrive xDM.dsk
  113.     ChangeTaskPri 0
  114.     List >ENV:xdmfile xDM.dsk LFORMAT %L
  115.     If $xdmfile EQ "empty"
  116.         Echo "Please insert disk into drive $xdmdrive"
  117.         Skip startpack BACK
  118.     EndIf
  119. Else
  120.     If $xdmtracks EQ "1"
  121.         ChangeTaskPri 5
  122.         PackDev $xdmdrive xDM NC Q ALL
  123.     Else
  124.         ChangeTaskPri 5
  125.         PackDev $xdmdrive xDM NC Q
  126.     EndIf
  127.     ChangeTaskPri 0
  128.     Rename >NIL: xDM.pkd xDM.image
  129.     List >ENV:xdmfile xDM.image LFORMAT %L
  130.     If FAIL
  131.         Echo "Please insert disk into drive $xdmdrive"
  132.         Skip startpack BACK
  133.     EndIf
  134. EndIf
  135.  
  136. Echo "Archiving disk image... Please wait!"
  137.  
  138. If $xdmtracks EQ "3"
  139.     If $xdmmode EQ "lowmem"
  140.         LZX -bi16 -bo16 -m -P5 -U0 -w$xdmlzx -X0 -3 a $xdmdest xDM.dsk ENV:xdmskip ENV:xdmcount
  141.         Skip contcompress
  142.     EndIf
  143.     LZX -m -P5 -U0 -X0 -3 a $xdmdest xDM.dsk ENV:xdmskip ENV:xdmcount
  144. Else
  145.     If $xdmmode EQ "lowmem"
  146.         LZX -bi16 -bo16 -m -P5 -U0 -w$xdmlzx -X0 -3 a $xdmdest xDM.image
  147.         Skip contcompress
  148.     EndIf
  149.     LZX -m -P5 -U0 -X0 -3 a $xdmdest xDM.image
  150. EndIf
  151.  
  152. LAB contcompress
  153. Date >ENV:xdmdate2
  154. Echo >ENV:xdmtime2 "$xdmdate2" LEN=5
  155. Echo >ENV:xdmmins2 "$xdmtime2" FIRST=1 LEN=2
  156. Echo >ENV:xdmsecs2 "$xdmtime2" LEN=2
  157. List >ENV:xdmsize $xdmdest LFORMAT %L
  158. Eval >ENV:xdmpct 100-($xdmsize*100/901120)
  159.  
  160. If $xdmmins2 GT $xdmmins1
  161.     Eval >ENV:xdmtimer ($xdmmins2*60+$xdmsecs2)-($xdmmins1*60+$xdmsecs1)
  162. EndIf
  163.  
  164. If $xdmmins1 GT $xdmmins2
  165.     Eval >ENV:xdmtimer ($xdmmins2+60*60+$xdmsecs2)-($xdmmins1*60+$xdmsecs1)
  166. Else
  167.     Eval >ENV:xdmtimer ($xdmmins2*60+$xdmsecs2)-($xdmmins1*60+$xdmsecs1)
  168. EndIf
  169.  
  170. Echo "Archive size      : *e[1;32m$xdmsize*e[0m bytes"
  171. Echo "Percentage Saving : *e[1;32m$xdmpct*e[0m *e[1;32m%*e[0m"
  172.  
  173. If "$xdmtimer" NOT EQ "Mismatched parenthesis"
  174.     Echo "Mashing time      : *e[1;32m$xdmtimer*e[0m seconds"
  175. EndIf
  176.  
  177. Echo "*nProcess complete!"
  178. Skip getout
  179.  
  180. LAB decompress
  181. Set xdmdest {file}
  182. List >ENV:xdmcheck "$xdmdest" QUICK NOHEAD
  183. Echo >ENV:xdmcheck2 "$xdmcheck" LEN=3
  184.  
  185. If $xdmcheck2 NOT EQ "xdm"
  186.      Set xdmerror "notxdm"
  187.      Skip errorout
  188. EndIf
  189.  
  190. If NOT EXISTS "$xdmdest"
  191.     Set xdmerror "nofile"
  192.     Skip errorout
  193. EndIf
  194.  
  195. If $xdmdrive NOT EQ "RAD:"
  196.     Ask "*nEnsure disk is in $xdmdrive and press [RETURN]"
  197. EndIf
  198.  
  199. Date >ENV:xdmdate1
  200. Echo >ENV:xdmtime1 "$xdmdate1" LEN=5
  201. Echo >ENV:xdmmins1 "$xdmtime1" FIRST=1 LEN=2
  202. Echo >ENV:xdmsecs1 "$xdmtime1" LEN=2
  203. Echo "*n*e[32mxDM v2.0 - © 1995 Adam Chapman*e[0m"
  204. Echo "Decompressing disk image... Please wait!"
  205. LZX >NIL: -m -P5 -X0 x $xdmdest ENV: xdmcount xdmskip
  206. LZX -m -P5 -X0 x $xdmdest "$xdm" xDM.dsk xDM.image
  207.  
  208. If ERROR
  209.     Set xdmerror "notxdm"
  210.     Skip errorout
  211. EndIf
  212.  
  213. FailAt 20
  214. Cd "$xdm"
  215.  
  216. If NOT EXISTS xDM.dsk
  217.     If NOT EXISTS xDM.image
  218.         Set xdmerror "notxdm"
  219.         Skip errorout
  220.     EndIf
  221. EndIf
  222.  
  223. If EXISTS xDM.dsk
  224.     If NOT EXISTS ENV:xdmcount
  225.         Set xdmunpack 1
  226.         Set xdmcount 1760
  227.         Set xdmskip 0
  228.         Skip unpackcont
  229.     EndIf
  230.     Set xdmunpack 2
  231. EndIf
  232.  
  233. If EXISTS xDM.image
  234.     Set xdmunpack 3
  235. EndIf
  236.  
  237. LAB unpackcont
  238. Echo "Writing disk image... Please wait!"
  239.  
  240. If $xdmunpack EQ "3"
  241.     ChangeTaskPri 5
  242.     PackDev xDM.image $xdmdrive NC Q ETDF
  243.     ChangeTaskPri 0
  244. Else
  245.     ChangeTaskPri 5
  246.     dd -c$xdmcount -s$xdmskip -w$xdmdrive xDM.dsk
  247.     ChangeTaskPri 0
  248. EndIf
  249.  
  250. Echo "Process complete!"
  251. DiskChange $xdmdrive
  252. Date >ENV:xdmdate2
  253. Echo >ENV:xdmtime2 "$xdmdate2" LEN=5
  254. Echo >ENV:xdmmins2 "$xdmtime2" FIRST=1 LEN=2
  255. Echo >ENV:xdmsecs2 "$xdmtime2" LEN=2
  256.  
  257. If $xdmmins2 GT $xdmmins1
  258.     Eval >ENV:xdmtimer ($xdmmins2*60+$xdmsecs2)-($xdmmins1*60+$xdmsecs1)
  259. EndIf
  260.  
  261. If $xdmmins1 GT $xdmmins2
  262.     Eval >ENV:xdmtimer ($xdmmins2+60*60+$xdmsecs2)-($xdmmins1*60+$xdmsecs1)
  263. Else
  264.     Eval >ENV:xdmtimer ($xdmmins2*60+$xdmsecs2)-($xdmmins1*60+$xdmsecs1)
  265. EndIf
  266.  
  267. If "$xdmtimer" NOT EQ "Mismatched parenthesis"
  268.     Echo "Decompression time      : *e[1;32m$xdmtimer*e[0m seconds"
  269. EndIf
  270.  
  271. Echo "*nProcess complete!"
  272. Skip getout
  273.  
  274. LAB errorout
  275. If $xdmerror EQ "fileexists"
  276.     Echo "*nSorry, but that xDM archive already exists."
  277.     Echo "Please give it another filename."
  278.     Skip getout
  279. Else
  280.     If $xdmerror EQ "nofile"
  281.         Echo "*nSorry, that file does not exist."
  282.         Echo "Please select an existing xDM archive."
  283.         Skip getout
  284.     EndIf
  285.     If $xdmerror EQ "lowmem"
  286.         Echo "*nSorry, you have selected a mode which suggests you have a low memory"
  287.         Echo "situation.  However, you do not have the low-memory variable *"xdmlzx*" set"
  288.         Echo "in your ENV: or ENVARC: directories.  Please refer to the documentation or"
  289.         Echo "re-install xDM, this time setting the *"xdmlzx*" low-memory variable to a"
  290.         Echo "location somewhere on a harddrive partition with at least 1mb free.*n"
  291.         Skip conterror
  292.     EndIf
  293.     If $xdmerror EQ "notxdm"
  294.         Echo "*nSorry, the file you are trying to unpack is not an xDM archive."
  295.         Echo "Please select a valid archive and try again."
  296.         Skip getout
  297.     EndIf
  298.     Echo "*nSorry, but I cannot find *"$xdmerror*" in your C: directory."
  299.     Echo "Please install xDM or *"$xdmerror*" again."
  300. EndIf
  301.  
  302. LAB conterror
  303. Cd "$xdm"
  304. Delete >NIL: xDM.dsk xDM.image
  305. Cd ENV:
  306. Delete >NIL: xdmaction xdmdev xdmseldrive xdmdest xdmtracks xdmdecompcont xdmskip xdmcount xdmfile xdmsize xdmpct xdmtimer xdmorigcd xdmversion xdmcheck xdmcheck2 xdmdate#? xdmtime#? xdmmins#? xdmsecs#?
  307. Cd "$xdmcd"
  308. UnSet xdmdrive
  309. UnSet xdmcount
  310. UnSet xdmskip
  311. UnSet xdmstarttrack
  312. UnSet xdmendtrack
  313. UnSet xdmmode
  314. UnSet xdmunpack
  315. UnSet xdmcd
  316. UnSet xdmerror
  317. UnSet xdm
  318. UnSet xdmsd
  319. UnSet xdmlzx
  320. UnSet xdmaction
  321. UnSet xdmdest
  322. UnSet xdmtracks
  323. FailAt 21
  324. Quit 20
  325.  
  326. LAB getout
  327. Cd "$xdm"
  328. Delete >NIL: xDM.dsk xDM.image
  329. Cd ENV:
  330. Delete >NIL: xdmaction xdmdev xdmseldrive xdmdest xdmtracks xdmdecompcont xdmskip xdmcount xdmfile xdmsize xdmpct xdmtimer xdmorigcd xdmversion xdmcheck xdmcheck2 xdmdate#? xdmtime#? xdmmins#? xdmsecs#?
  331. Cd "$xdmcd"
  332. UnSet xdmdrive
  333. UnSet xdmcount
  334. UnSet xdmskip
  335. UnSet xdmstarttrack
  336. UnSet xdmendtrack
  337. UnSet xdmmode
  338. UnSet xdmunpack
  339. UnSet xdm
  340. UnSet xdmsd
  341. UnSet xdmlzx
  342. UnSet xdmaction
  343. UnSet xdmdest
  344. UnSet xdmtracks
  345. UnSet xdmerror
  346. UnSet xdmcd
  347.